package com.fcc.wfly.utils;

import org.apache.commons.lang.StringUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigUtils {
    private static Properties config = getProperties();

    private static Properties getProperties() {
//        String env = System.getProperty("lfsonarenv");
    	String env = "dev";
        if (StringUtils.isEmpty(env)) {
            env = "local";
        }
        Properties prop = new Properties();
        InputStream in = ConfigUtils.class.getResourceAsStream("/config." + env + ".properties");
        try {
            prop.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return prop;
    }

    public static String getProperty(String key) {
        return config.getProperty(key);
    }
}
